// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store' //vuex
import "./assets/bus/js/flexible.js"
// import wx from 'weixin-js-sdk' //引入微信的JSSDK
// Vue.prototype.wx = wx //引入微信的JSSDK

import wechatShare from "./assets/bus/js/wecahtshare.js"; 
Vue.prototype.$wechatShare  = wechatShare 

import VueAwesomeSwiper from 'vue-awesome-swiper'
import 'swiper/dist/css/swiper.css'
Vue.use(VueAwesomeSwiper)

// import VueSocketio from 'vue-socket.io'; //实施更新
// Vue.use(VueSocketio, 'http://socketserver.com:1923'); 示例
// Vue.use(VueSocketio, socketio('http://localhost:8080'));

Vue.config.productionTip = false

import './assets/bus/css/reset.css' // 公共样式
import './assets/bus/css/bus.css' // 公共样式

import busPoat from './assets/bus/js/busPoatrouter.js'//接口
Vue.prototype.$busPoat = busPoat

import iosAndroid from './assets/bus/js/iosAndroid.js'//终端判断
Vue.prototype.$iosAndroid = iosAndroid

import Distpicker from 'v-distpicker' //三级联动
Vue.component('v-distpicker', Distpicker)

import AxiosPOSTrouter from './assets/bus/js/AxiosPOSTrouter.js' //封装接口(放弃)
Vue.prototype.$AxiosPOST = AxiosPOSTrouter


import axios from 'axios'
Vue.prototype.axios = axios


// --------------- 全局的拦截器-------------loading动画
// 添加请求拦截器
axios.interceptors.request.use(
  // 在发送请求之前做些什么
  config => {
    if(sessionStorage.getItem('token')){  // 判断是否存在token，如果存在的话，则每个http header都加上token  
      config.headers.Authorization = sessionStorage.getItem('token');
    }
    return config;
  },
  error => {
    // 对请求错误做些什么
    return Promise.reject(error);
  }
)
// // 添加响应拦截器
// axios.interceptors.response.use(function (response) {
//   // 对响应数据做点什么
//   return response;
// }, function (error) {
//   // 对响应错误做点什么
//   return Promise.reject(error);
// });


/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'

})
